import React from 'react'
import { SimpleSelector } from './simpleSelector'

export const RetryTimesSelector = ({ inputClassName, initValue, onSelectItem, readOnly }) => {
    const dataSource = [{ code: '0', remark: '不重试' }, { code: '1', remark: '1次' }, { code: '2', remark: '2次' }]
    const filterDataSource = React.useCallback(value => item => item.code === value.toUpperCase() || item.remark.includes(value), [])
    const getItemValue = React.useCallback(item => item.code, [])
    const renderItem = React.useCallback(item => `${item.code}[${item.remark}]`, [])

    return <SimpleSelector inputClassName={inputClassName} dataSource={dataSource} filterDataSource={filterDataSource}
        getItemValue={getItemValue} initValue={initValue} onSelectItem={onSelectItem}
        readOnly={readOnly} renderItem={renderItem} />
}